<template>
  <div class="content-box">
    <h6 class="title-h6">查看产品</h6>
      <product-add :operate-type="type" :form-data="formData"></product-add>
  </div>
</template>
<script>
import ProductAdd from '@/components/Product/ProductAdd'
import axios from 'axios'
import {ProductUrl, getHeader } from '@/config/config'
import {mapGetters, mapActions} from 'vuex'
export default {
  name: 'ProductInfo',
  data() {
    return {
      type: 'info',
      formData: {}
    }
  },
  components: {
     ProductAdd 
  },
  created() {
    console.log(this.$route.params.proId)
    this.getData()
  },
  methods: {
    ...mapActions([
      'setProInfo'
    ]),
    getData() {
      let api_url = `${ProductUrl}/${this.$route.params.proId}`
      let _this = this
      axios.get(api_url, { headers: getHeader()})
      .then(response => {
        console.log(response)
        if(response.status === 200 & response.data.success) {
            // let proInfo = {
            //   name: response.data.data.name, // 产品名称
            //   alias: '', // 产品别名
            //   admin_url: '', // 后台链接
            //   account_and_password: '', // 账号和密码
            //   has_not_contract_reason: '', // 不结算说明
            //   company_id: '', // 签约公司id
            //   user_id: [] // 项目负责人id
            // }
            _this.setProInfo(response.data.data)
            _this.formData = response.data.data
        }
      })
    }
  }
}
</script>
